
#include <iostream>
#include <cassert>
#include <vector>
#include <cmath>
#include <fstream>
#include <iomanip>
using namespace std;

const double pi{acos(-1.0)};

struct fun1
{
    double operator()(const double &x)
    {
        return sqrt(x) * (1.0 - x) / exp(15.0 * x);
    }
};

struct fun2
{
    double operator()(const double &x)
    {
        return pow(sin(pi * pow(x, 0.25)), 3);
    }
};

struct fun3
{
    double operator()(const double &x)
    {
        return pow(sin(pi * pow(x, 0.757)), 3);
    }
};

struct fun4
{
    double operator()(const double &x)
    {
        return pow(sin(pi * pow(x, 1.357)), 3);
    }
};

struct fun5
{
    double operator()(const double &x)
    {
        return sqrt(x) * (1.0 - x) / exp(10.0 * x);
    }
};

int main()
{
    constexpr int NUM_POS{1000};
    constexpr double real_num = static_cast<double>(NUM_POS);
    vector<double> pos(NUM_POS);
    for (int i = 0; i <= NUM_POS; ++i)
    {
        pos[i] = static_cast<double>(i) / real_num;
    }

    ofstream os{"output.dat"};
    os << "TITLE = \" visualization of the five equation\" \n"
       << "VARIABLES = \"x\", \"y1\", \"y2\", \"y3\", \"y4\", \"y5\"\n";
    fun1 f1;
    fun2 f2;
    fun3 f3;
    fun4 f4;
    fun5 f5;
    os << scientific << setprecision(16);
    double x;
    for (int i = 0; i <= NUM_POS; ++i)
    {
        x = pos[i];
        os << x << "\t"
           << f1(x) << "\t"
           << f2(x) << "\t"
           << f3(x) << "\t"
           << f4(x) << "\t"
           << f5(x) << "\n";
    }

    return 0;
}